package src.com.susiqi.result;

import lombok.Data;

@Data
public class Result {
    private Integer code;
    private String msg;
    private Object data;

    public  Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    //操作成功
    public static Result success(Object data) {
        Result result = new Result(200,"success",data);
        return result;
    }
    //操作成功无参
    public static Result success() {
        Result result = new Result(200,"success",null);
        return result;
    }
    //操作失败无参
    public static Result fail() {
        Result result = new Result(500,"fail",null);
        return result;
    }
    //操作失败
    public static Result fail(String msg) {
        Result result = new Result(500,msg,null);
        return result;
    }
}